package com.xgq.drink.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xgq.drink.entity.OrderProduct;
import com.xgq.drink.entity.R;
import com.xgq.drink.service.IOrderProductService;
import com.xgq.drink.utils.RUtils;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xgq
 * @since 2025-03-04
 */
@RestController
@RequestMapping("/orderProduct")
public class OrderProductController {
    @Autowired
    private IOrderProductService orderProductService;

    @GetMapping("/{orderId}")
    @Operation(summary = "获取订单商品明细")
    public R getOrderProducts(@PathVariable Long orderId) {
        QueryWrapper<OrderProduct> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_id", orderId);
        return RUtils.success("结果",orderProductService.list(queryWrapper));
    }
}
